package unit7;

import java.util.Scanner;

public class Test2 {

	@SuppressWarnings("resource")
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		while(true) {
			System.out.println("请输入一个八位数【若是八个零就退出系统】");
			String LuckNumStr=scanner.next();
			if("00000000".equals(LuckNumStr)) {
				System.out.println("退出系统");
				break;
			} else {
				if(LuckNumStr.length()!=8) {
					System.out.println("不是八位退出");
					continue;
			}
			else {
				boolean flag=true;
				for(int i=0;i<=LuckNumStr.length()-1;i++) {
					char c=LuckNumStr.charAt(i);
					if(c<'0'||c>'9') {
						flag=false;
						break;
					}
				}
				if (flag) {
					if(LuckNumStr.charAt('0')=='0') {
						System.out.println("最高位不能是0");
					}
				else {
					long luckNum=Long.parseLong(LuckNumStr);
					int sum=0;
					do {
						sum+=luckNum%10;
						luckNum/=10;
					}while(luckNum!=0);
						if(sum%7==0){
							System.out.println("中奖了");
						}else {
							System.out.println("没中奖");
						}
						
			}
			}else {
				System.out.println("有非数字");
		}
	}

}
		}
	}
}

